﻿namespace EFMLEditor.Internal
{
    using updateSystemDotNet;

    public class UpdateController
    {
        private static updateController updController;
        public static void Init()
        {
            updController = new updateController
                {
                    updateUrl = "http://furesoft.pf-control.de/updates/efmleditor/",
                    projectId = "4cf873e7-fc46-4a09-a1c3-819909eee498",
                    publicKey =
                        "<RSAKeyValue><Modulus>tV1DoVlQcZQxGT7/qWhNs2wjbSY99TlzhFVcHAtQ/Yyh43otX1lxYEE4wiRr00Rhzrn7aT8OvFsrcBY7+48V4OcnLAecoPkllcjP4+2KH7heVrVt9rWZ7VKV2EqpBQ0G39grSC/uT+G3FOxatVFTexdwMmVgRrw1VE1KJPypnftceiZ3Jii7Ub+jsI6LYHXMdShbNEiH7/ckjKtZW2EXCuifNPWwJLGpcEAyiedOodNK0w2yh+uJmM1Z80kFbX6lWUUGDjchW3VFqBEYz2iRCUTQbqte6PC3Dv+GCelpUtERYnjH6fGNM47OlDYIc5HP5Y0wxGiKuaIxBT1+U5nGGo+q8gbvufCC30ryysBXOjxwpYUmb6avhubaYIC6teM7v1gik81HPkewsdHzpsZU+5nU+YKGAEzZpXObOB6ktk27Ztae+0QPzOuqu49N+d1AIloj2wELX4X3qSbpzCbrynszMpLOgewejducz64MXckGM24BSI0PQ35oww/3hQ570aNE+wnS6t9LqGugXmjFKBlbLeoZ/yFA4M5dIw/AUN4trVYX3Is8BIAFlC0/JwGxBDeb9IfumFRLQuowO+T9w9/JRbnXi/H1ua+2iBu2uIh+s7AK06ukJqXQ3PIaxJeZnLrlq8Zye6bt6WWY7uMM4yZk1k1xFAE0vfLxBWbLwF0=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>",
                    releaseFilter = { checkForFinal = true, checkForBeta = true, checkForAlpha = true },
                    restartApplication = true,
                    retrieveHostVersion = true,
                };
        }
        public static void CheckDialog()
        {
            updController.updateInteractive();
        }
        public static void Check()
        {
            if(updController.checkForUpdates())
            {
                CheckDialog();
            }
        }
    }
}
